package com.example.a.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class SpaController {

    /**
     * 处理所有前端路由，将请求转发到index.html
     * 这样Vue Router就可以处理客户端路由
     */
    @RequestMapping(value = {
        "/",
        "/home",
        "/login", 
        "/register",
        "/profile",
        "/address",
        "/cart",
        "/checkout",
        "/payment/**",
        "/orders",
        "/payment-callback",
        "/products",
        "/product/**",
        "/search",
        "/shop",
        "/footprint",
        "/my-reviews",
        "/admin",
        "/admin/**"
    })
    public String forward() {
        return "forward:/index.html";
    }
}
